package lab02.test19;
import java.util.Scanner;

public class Test {
    private static String reverse(String input) {
        {
            if(input.isEmpty()){
                return "";
            }
        }
        String end = input.substring(input.length() - 1, input.length());
        char[] cs = end.toCharArray();
        if (cs[0] <= 'Z' && cs[0] >= 'A') {
            end = end.toLowerCase();
        } else if (cs[0] <= 'z' && cs[0] >= 'a') {
            end = end.toUpperCase();
        }
        String prev = input.substring(0, input.length() - 1);
        return reverse(prev) + end;
    }
    public static void main(String[] args) {
        System.out.println(reverse("HelloWord"));
    }
}
